package j01zuoyongyu;

public class J1 {
    public static void main(String[] args) {
//        System.out.println(a);
        //局部变量
        int a = 4;
//        int a = 7;
        System.out.println(a);
    }

    public static void f1(int x){
        System.out.println(x);

//        int x = 55;

//        System.out.println(a);
    }
    //可见性
    public static void f2(){
        int a = 5;
        System.out.println(a);
        if(true){
            System.out.println(a);
//            System.out.println(b);

            if(true){
                System.out.println(a);
            }
            //外面看不到里面
            int m = 55;
        }
        int b = 4;
//        System.out.println(m);
    }

    //for中变量
    public static void f3(){
//        int i = 9;
        for (int i = 0; i < 10; i++) {
            System.out.println(i);

//            int i = 99;
//            i=9;
        }

//        System.out.println(i);

        for (int i = 0; i < 10; i++) {

        }
    }
}

class Cat{

    public void f2(){
        System.out.println(age);
    }
    //整个类可用，不分先后顺序
    int age = 5;

    public void f1(){
        System.out.println(age);
    }
    int blood = 1;

}
